/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.uq.comp7705.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author javierpanchi
 */
@Entity
@Table(name = "drinks.drk_drink")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Drink.findAll", query = "SELECT d FROM Drink d"),
    @NamedQuery(name = "Drink.findById", query = "SELECT d FROM Drink d WHERE d.id = :id"),
    @NamedQuery(name = "Drink.findByName", query = "SELECT d FROM Drink d WHERE d.name = :name"),
    @NamedQuery(name = "Drink.findByLevel", query = "SELECT d FROM Drink d WHERE d.level = :level"),
    @NamedQuery(name = "Drink.findBySmallIcon", query = "SELECT d FROM Drink d WHERE d.smallIcon = :smallIcon"),
    @NamedQuery(name = "Drink.findByBigIcon", query = "SELECT d FROM Drink d WHERE d.bigIcon = :bigIcon")})
public class Drink implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "name")
    private String name;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "level")
    private Double level;
    @Column(name = "smallIcon")
    private String smallIcon;
    @Column(name = "bigIcon")
    private String bigIcon;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "drkDrinksId", fetch = FetchType.LAZY)
    private List<SessionDrink> sessionDrinkList;

    public Drink() {
    }

    public Drink(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Double getLevel() {
        return level;
    }

    public void setLevel(Double level) {
        this.level = level;
    }

    public String getSmallIcon() {
        return smallIcon;
    }

    public void setSmallIcon(String smallIcon) {
        this.smallIcon = smallIcon;
    }

    public String getBigIcon() {
        return bigIcon;
    }

    public void setBigIcon(String bigIcon) {
        this.bigIcon = bigIcon;
    }

    @XmlTransient
    public List<SessionDrink> getSessionDrinkList() {
        return sessionDrinkList;
    }

    public void setSessionDrinkList(List<SessionDrink> sessionDrinkList) {
        this.sessionDrinkList = sessionDrinkList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Drink)) {
            return false;
        }
        Drink other = (Drink) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.uq.comp7705.entity.Drink[ id=" + id + " ]";
    }
    
}
